package com.ljc;

import com.alibaba.cloud.seata.rest.SeataRestTemplateAutoConfiguration;
import com.ljc.websocket.WebSocketService;
import io.seata.spring.annotation.datasource.EnableAutoDataSourceProxy;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
import org.springframework.context.ApplicationContext;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;

@SpringBootApplication(exclude = {
        DataSourceAutoConfiguration.class,
        DataSourceTransactionManagerAutoConfiguration.class,
        HibernateJpaAutoConfiguration.class,
        SeataRestTemplateAutoConfiguration.class})
@EnableDubbo
@EnableAsync
@EnableScheduling
@EnableAutoDataSourceProxy
public class apiApplication {
    public static void main(String[] args) {
        ApplicationContext app = SpringApplication.run(apiApplication.class, args);
        // 为WebSocket设置唯一的容器环境
        WebSocketService.setApplicationContext(app);
    }
}